class Solution {
public:
    bool canReach(vector<int>& arr, int start)
    {
        int n = arr.size();
        vector<int> visted(n, false);
        queue<int> q;
        visted[start] = true;
        q.push(start);

        while (!q.empty())
        {
            int cur = q.front();
            q.pop();
            if (arr[cur] == 0) return true;

            int next = cur - arr[cur];
            if (next >= 0 && next < n && visted[next] == false)
            {
                visted[next] = true;
                q.push(next);
            }
            next = cur + arr[cur];
            if (next >= 0 && next < n && visted[next] == false)
            {
                visted[next] = true;
                q.push(next);
            }
        }

        return false;
    }
};